<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="template.xhtml"
    xmlns:apks="http://java.sun.com/jsf/composite/apks"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <f:metadata>
        <f:viewParam name="id" value="#{loginManagedBean.sessionId}"/>
    </f:metadata>

    <ui:define name="title">
        Login Page:
    </ui:define>
    <ui:define name="center">
        <table align="center">
            <tr>
                <td>
            <p:panel id="panel" header="Forma za prijavu:">
                <h:form>
                    <p:messages id="msgs" showSummary="false" showDetail="true"/>
                    <h:panelGrid columns="2" cellpadding="3">
                        <h:outputLabel for="username" value="Korisnicko ime:"/>
                        <p:inputText id="username" required="true" value="#{loginManagedBean.username}"><p:watermark for="username" value="vase korisnicko ime"/><p:focus/></p:inputText>
                        <h:outputLabel for="password" value="Sifra:"/>
                        <p:password feedback="" minLength="5" id="password" required="true" requiredMessage="Polje za unos sifre ne moze biti prazno!" value="#{loginManagedBean.password}"><p:watermark for="password" value="vasa sifra"/></p:password>
                        <p:ajaxStatus>  
                            <f:facet name="start">  
                                <h:graphicImage style="width: 30px;height: 30px;" value="/images/spinner.gif" />  
                            </f:facet>  
                            <f:facet name="complete">  
                                <h:outputText value="" />  
                            </f:facet>  
                        </p:ajaxStatus>  
                        <p:commandButton value="Login" action="#{loginManagedBean.login()}" update="panel"/>
                    </h:panelGrid>
                </h:form>
                <h:form>
                    <h:panelGrid columns="2" cellpadding="3">
                        <p:commandLink value="Registracija" action="/register.xhtml?faces-redirect=true" ajax="false"/>
                        <p:commandLink value="Problemi sa prijavljivanjem" action="/forgot.xhtml?faces-redirect=true" ajax="false"/>
                    </h:panelGrid>
                </h:form>
            </p:panel>
            </td>
            </tr>
        </table>
    </ui:define>
</ui:composition>